xend: add a description config item for each guest.
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 16 Oct 2009 07:24:47 +0000 (08:24 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 16 Oct 2009 07:24:47 +0000 (08:24 +0100)
Add a new option "description=" to each VM to increase the
manageability of VM, which could be accessed via "xm list -l
MACHINE".e.g add "description='(name, james),(priority 5), (owner
james.song@company.com)'" to configure file, User can get the VM's
attribute easily by "xm list -l Machine" or some tools.

Signed-off-by: James Song<jsong@novell.com>
tools/python/xen/xend/XendConfig.py
tools/python/xen/xm/create.py
tools/python/xen/xm/xenapi_create.py

index b94175cd47d1c5da5077504efa6c0fe51e0a33bd..8c70fab6129a14d68876007a4c2b1703091b1e5c 100644 (file)
@@ -177,6 +177,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'pci_power_mgmt': int,
     'xen_platform_pci': int,
     "gfx_passthru": int,
+    'description': str,
 }
 
 # Xen API console 'other_config' keys.
@@ -490,6 +491,8 @@ class XendConfig(dict):
                 self['platform']['xen_platform_pci'] = 1
             if 'vpt_align' not in self['platform']:
                 self['platform']['vpt_align'] = 1
+            if 'description' not in self['platform']:
+                self['platform']['description'] = ''
             if 'loader' not in self['platform']:
                 # Old configs may have hvmloader set as PV_kernel param
                 if self.has_key('PV_kernel') and self['PV_kernel'] != '':
index f929011bc72dc4f6caa9366dbd46e88a30e07d0f..e47db2f1406296c51ad7139b4772ea926656ec63 100644 (file)
@@ -507,6 +507,10 @@ gopts.var('usbdevice', val='NAME',
           fn=set_value, default='',
           use="Name of USB device to add?")
 
+gopts.var('description', val='NAME',
+          fn=set_value, default='',
+          use="Description of a domain")
+
 gopts.var('guest_os_type', val='NAME',
           fn=set_value, default='default',
           use="Guest OS type running in HVM")
@@ -989,7 +993,7 @@ def configure_hvm(config_image, vals):
              'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check',
              'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate',
              'vpt_align', 'pci_power_mgmt', 'xen_platform_pci',
-             'gfx_passthru' ]
+             'gfx_passthru', 'description' ]
 
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:
index 6af21188a943d86793508b8fc34096bf695b4a38..d8e9dc54c774121d4c14d07d5f03a12848a58bc0 100644 (file)
@@ -1077,6 +1077,7 @@ class sxp2xml:
             'pci_power_mgmt',
             'xen_platform_pci',
             'tsc_native'
+            'description',
         ]
 
         platform_configs = []